package com.raidroid.rdmute;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.widget.Toast;

public class RDMuteAutoStartup extends BroadcastReceiver {

	@Override
	public void onReceive(Context context, Intent intent) {		
		SharedPreferences sp = context.getSharedPreferences("com.raidroid.rdmute_preferences", 0);		
		boolean isServiceStart = sp.getBoolean("RDMute_StartOnBoot_OnOf", true);
		if(isServiceStart)
		{		
			Intent serviceIntent = new Intent();
			serviceIntent.setAction("com.raidroid.rdmute.RDMuteService");
			context.startService(serviceIntent);
			SharedPreferences.Editor editor = sp.edit();
			editor.putBoolean("RDMUte_Service_OnOf", true);
			editor.commit();
						
		}else{			
			Toast.makeText(context, "RD Mute Startup _ FALSE", 10000).show();
			SharedPreferences.Editor editor = sp.edit();
			editor.putBoolean("RDMUte_Service_OnOf", false);
			editor.commit();
		}			
	}
}
